$(function(){
	var currentUrl = window.location.href;
	/*alert(currentUrl);*/
	var id = location.search.match(new RegExp("[\?\&]id=([^\&]+)", "i"))[1];
	var p ={id:id};
	 $.ajax({
		  type:"POST",
		  url:"/movie.front/movieInfo/getMovieInfoById",
		  data:JSON.stringify(p),
		  dataType:"json",
		  contentType:"application/json",
		  success:function(data){
            var data = data.result;
           var html ='<h3>'+data.movieName+'</h3>'+'<ul class="size"><h4>'+data.movieCategory+'</h4></ul>'+
                     '<ul class="size"> <h4>上映时间</h4></ul><div class="galry"><div class="prices"><h5>价格：'+data.moviePrice+'元</h5>'+
                     '</div><div class="clearfix"></div></div>';
                   $('#check-movieInfo').append(html);
                     var url='http://localhost:8080/';
                      var str ='<li style="list-style:none"><div class="thumb-image"><img class="img-responsive" style="width:280px" src='+url+data.moviePicture+'></div></li><li  id="check-hallId"  style="display:none">'+data.hallId+'</li>';
                      $('.flexslider  ul').append(str);
                      $('#intro-movieInfo').append("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font>"+data.movieIntro+"</font>");       
		              $('#hall-title').append('<h4 class="modal-title" id="myModalLable">'+data.hallName+'</h4>');
		  }
	   });
	
		  $.ajax({
		  type:"POST",
		  url:"/movie.front/peopleController/getPeopelInfo",
		  data:JSON.stringify(p),
		  dataType:"json",
		  contentType:"application/json",
		  success:function(data){
            var arr = data.result;
            var url = 'http://localhost:8080/';
            for(var i=0;i<arr.length;i++){
          var html='<div class="product-grid col-md-1" style="width:200px"><div class="more-product">'+
          '<span></span></div><div class="product-img b-link-stripe b-animate-go thickbox"><img class="img-responsive" alt="" src='+url+arr[i].moviePersonPicture+'>'+
          '<div class="b-wrapper"></div></div><div class="product-info simpleCart_shelfItem"><div class="product-info-cust prt_name"><h4>'+arr[i].personName+'</h4></div></div></div>';
          
             
               $('#picture-personInfo').append(html);
            	}
		    }
	   });
		 
		  /**
		   * 页面跳转
		   */
		  $('#purchase-ticket').click(function(){
			  window.location.href="checkout.html?id="+id;
		  });
		  
		  $('#myCart').click(function(){
				$.ajax({
					  type:'POST',
					  url:'/movie.front/orderController/getOrderListsByUserId',
					  dataType:'json',
					  contentType:'application/json',
					  success:function(data){
						 if(data.result[0].statusCode!=null){
							  alert(data.result[0].statusCode);
							 window.location.href="account.html";
						 }else{
							 $('#myorders-table').empty();
							 var data =data.result;
							 for(var i=0;i<data.length;i++){
								 var html='';
								 html = html+'<tr><td  align="center">'+data[i].orderName+'</td><td  align="center">'+data[i].orderPrice+'元</td><td  align="center">'+data[i].orderTime+'</td></tr>';
								 $('#myorders-table').append(html);
							 }
						 }
					  }
				});
			});
});		 

